<!DOCTYPE html>
<html lang="en">
<head>
     <meta charset="UTF-8">
     <title>HTML to Image to PDF</title>
     <link rel="stylesheet" href="./css/print-lock.css">
     <style>
          /* 在线链接服务仅供平台体验和调试使用，平台不承诺服务的稳定性，企业客户需下载字体包自行发布使用并做好备份。 */
          @font-face {
               font-family: "AlimamaDongFangDaKai-Regular";
               src: url("./fonts/AlimamaDongFangDaKai-Regular.woff2") format("woff2");
               font-display: swap;
          }
          @font-face {
               font-family: "AlimamaDaoLiTi";
               src: url("./fonts/AlimamaDaoLiTi.woff2") format("woff2");
               font-display: swap;
          }
          @font-face {
               font-family: "AlimamaShuHeiTi-Bold";
               src: url("./fonts/AlimamaShuHeiTi-Bold.woff2") format("woff2");
               font-display: swap;
          }
          @font-face {
               font-family: "AlimamaFangYuanTiVF-Thin";
               src: url("./fonts/AlimamaFangYuanTiVF-Thin.woff2") format("woff2");
               font-display: swap;
          }
          @font-face {
               font-family: "QianTuXiaoTuTi-2";
               src: url("./fonts/QianTuXiaoTuTi-2.ttf") format("truetype");
               font-display: swap;
          }
     </style>

</head>
<body>
     <div class="web-printTemplate" id="web-printTemplate">
     </div>
     <script>
          // 清空打印内容
          const printContent = document.getElementById('web-printTemplate');
          printContent.innerHTML = '';
          // 获取url参数
          const urlParams = new URLSearchParams(window.location.search);
          const id = urlParams.get('id');
          if (id) {
               // 设置修改title
               document.title = "打印-" + id;
               fetch(`/print/getHtmlById?id=${id}`)
                    .then(res => res.json())
                    .then(data => {
                         // 获取打印内容
                         const printContent = document.getElementById('web-printTemplate');
                         printContent.innerHTML = data.data.html ?? "";
                    })
                    .catch(err => {
                         console.error('获取打印内容失败', err);
                    });
          }
     </script>
</body>
</html>